var layerId;
$(function(){
	$("#search-button").click(function(){
		
		var data = new Object();
		data.pageNo = 1;
		data.keyword=$("input[name='keyword']").val();
		data.status=$("select[name='status']").val();
		data.createTimeStart=$("#createTimeStart").val();
		data.createTimeEnd=$("#createTimeEnd").val();
		data.refundTimeStart=$("#refundTimeStart").val();
		data.refundTimeEnd=$("#refundTimeEnd").val();
		data.refundJeMin=$("input[name='refundJeMin']").val();
		data.refundJeMax=$("input[name='refundJeMax']").val();

	    var form = $("<form method='post'></form>");
	    form.attr("action",basePath+"/refund/query.shtml");
	    for (arg in data) {
	        var input = $("<input type='hidden'>");
	        input.attr({ "name": arg });
	        input.val(data[arg]);
	        form.append(input);
	    }
	    form.submit();
	});
})
function fanye(pageNo){
	var data = new Object();
	data.pageNo = pageNo;
	data.keyword=init.keyword;
	data.status=init.status;
	data.createTimeStart=init.createTimeStart;
	data.createTimeEnd=init.createTimeEnd;
	data.refundTimeStart=init.refundTimeStart;
	data.refundTimeEnd=init.refundTimeEnd;
	data.refundJeMin=init.refundJeMin;
	data.refundJeMax=init.refundJeMax;

    var form = $("<form method='post'></form>");
    form.attr("action",basePath+"/refund/query.shtml");
    for (arg in data) {
        var input = $("<input type='hidden'>");
        input.attr({ "name": arg });
        input.val(data[arg]);
        form.append(input);
    }
    form.submit();
}
function showOrderDetail(orderId){
	layerId=layer.open({
		title: "订单详情",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/order/showDetail.shtml?orderId='+orderId
	});
}
function editFun(topicId){
	layerId=layer.open({
		title: "修改话题",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/topic/edit.shtml?topicId='+topicId
	});
}
function sendGoodsFun(refundId){
	layerId=layer.open({
		title: "填写发货信息",
		area: ['60%','60%'],
		fix:true,
		type: 2,
		content: basePath+'/refund/refundExpress.shtml?refundId='+refundId
	});
}
function showDetail(refundId){
	layerId=layer.open({
		title: "售后单详情",
		maxmin:true,
		area: ['80%','80%'],
		fix:true,
		type: 2,
		content: basePath+'/refund/showDetail.shtml?refundId='+refundId
	});
}
function takeGoodsFun(refundId){
	layerId=layer.open({
		title: "填写收货信息",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/refund/takeGoods.shtml?refundId='+refundId
	});
}
function refundMoneyFun(refundId){
	layerId=layer.open({
		title: "填写退款金额",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/refund/refundMoney.shtml?refundId='+refundId
	});
}
function editRefundFun(refundId){
	layerId=layer.open({
		title: "修改售后单",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/refund/edit.shtml?refundId='+refundId
	});
}
function checkRefundFun(refundId,status){
	if(confirm("确认审核？")){
		 $.ajax({
	  		 url:basePath+"/refund/checkRefund.shtml?refundId="+refundId+"&status="+status,  
	  		 type:"post",
	  		 dataType:"JSON",
	  		 success:ajaxSuccessRefreshFun
	  	 });
	}
}
